package com.bigzero.workflow.modules.system.vo;

import com.bigzero.workflow.modules.system.entity.RoleEntity;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户activiti vo
 * @Author: fanxinxiong
 * @Date: 2025-02-13 14:48:00
 */
@Data
public class UserActivitiVo extends UserVo{

    private List<RoleEntity> roleList;
    private List<SimpleRole> simpleRoleList = new ArrayList<>();

    public List<SimpleRole> getSimpleRoleList() {
        List<SimpleRole> list = new ArrayList<>();
        if(!CollectionUtils.isEmpty(roleList)){
            for(RoleEntity roleEntity : roleList){
                SimpleRole simpleRole = new SimpleRole();
                simpleRole.setId(roleEntity.getId());
                simpleRole.setName(roleEntity.getName());
                list.add(simpleRole);
            }
        }
        return list;
    }

    @Data
    public static class SimpleRole {
        private String id;
        private String name;
    }
}
